﻿''' <summary>
''' 共有フォルダーリスト画面のフォームです。
''' </summary>
''' <remarks></remarks>
Public Class VolumeList
  Inherits Page

#Region " プライベートフィールド "
  Private selectedFolder As Volume
#End Region

#Region " イベントハンドラ "
  Private Sub FolderDataSource_Selected(
    sender As Object, e As ObjectDataSourceStatusEventArgs) Handles FolderDataSource.Selected

    Me.CountLabel.Text = String.Format("{0} 個のオブジェクト", DirectCast(e.ReturnValue, ICollection).Count)
  End Sub

  Private Sub DetailDataSource_Selecting(
    sender As Object, e As ObjectDataSourceSelectingEventArgs) Handles DetailDataSource.Selecting

    If Me.FolderListBox.SelectedIndex = -1 Then
      e.Cancel = True
    End If
  End Sub

  Private Sub DetailDataSource_Selected(
    sender As Object, e As ObjectDataSourceStatusEventArgs) Handles DetailDataSource.Selected

    selectedFolder = DirectCast(e.ReturnValue, Volume)
  End Sub

  Private Sub DetailFormView_DataBound(sender As Object, e As EventArgs) Handles DetailFormView.DataBound
    If Me.FolderListBox.SelectedIndex >= 0 Then
      Dim txt = DirectCast(Me.DetailFormView.FindControl("KeywordTextBox"), TextBox)
      txt.Text = String.Join(Environment.NewLine, selectedFolder.Keywords)
    End If
  End Sub

  Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Response.Redirect("Main.aspx?idx=5")
  End Sub
#End Region
End Class